import http from './http.js'

// 列表
const goodsList = (pageNumber,pageSize) => {
  return http.get('/goods/list',{
    params:{
      pageNumber,
      pageSize,
    }
  })
}

//修改状态
const goodsStatus = (status,ids) => {
  return http.put(`/goods/status/${status}`,{ids})
}

// 三级联动选择器
const categoriesSelect = (pageNumber,pageSize,categoryLevel,parentId) => {
  return http.get('/categories',{
    params:{
      pageNumber,
      pageSize,
      categoryLevel,
      parentId
    }
  })
}

// 新增
const goodsAdd = (data) => {
  return http.post(`/goods`,data)
}

// 获取单条数据
const goodsInfo = (id) => {
  return http.get(`/goods/${id}`)
}

export default {
  goodsList,
  goodsStatus,
  categoriesSelect,
  goodsAdd,
  goodsInfo
}